package org.mparts.client.mvp;

import org.mparts.client.place.AddressPlace;
import org.mparts.client.place.CatalogPlace;
import org.mparts.client.place.MainPlace;

import com.google.inject.Inject;
import com.google.inject.Provider;

/**
 * 
 * A place factory which knows about all the tokenizers in the app
 */
public class AppPlaceFactory {
	
	public AppPlaceFactory() {
		
	}

	// A single instance of the tokenizer should work, since they don't have
	// state.
	@Inject
	MainPlace.Tokenizer mainPlaceTokenizer;
	
	@Inject
	Provider<MainPlace> mainProvider;


	@Inject
	CatalogPlace.Tokenizer catalogPlaceTokenizer;
	
	@Inject
	Provider<CatalogPlace> catalogProvider;

	@Inject
	AddressPlace.Tokenizer addressPlaceTokenizer;
	
	@Inject
	Provider<AddressPlace> addressProvider;

	// main place
	public MainPlace.Tokenizer getMainPlaceTokenizer() {
		return mainPlaceTokenizer;
	}

	public MainPlace getMainPlace() {
		return mainProvider.get();
	}
	
	// catalog place
	public CatalogPlace.Tokenizer getCatalogPlaceTokenizer() {
		return catalogPlaceTokenizer;
	}

	public CatalogPlace getCatalogPlace() {
		return catalogProvider.get();
	}
	
	// catalog place
	public AddressPlace.Tokenizer getAddressPlaceTokenizer() {
		return addressPlaceTokenizer;
	}

	public AddressPlace getAddressPlace() {
		return addressProvider.get();
	}
	
	
}
